//项目中接口请求都放在这里
import instance from "./request";


//定义接口请求
//首页
export function getIndexData(params){
    return instance({
        url:'/index/index',
        method:'get',
        params:params,
    })
}
//搜索页 根据关键字搜素
export function GetSearchData(params) {
    return instance({
        url: '/goods/list',
        method: 'get',
        params
    })
}

//首页导航
export function CategoryData(params){
    return instance({
        url:'/goods/category',
        method:'get',
        params:params,
    })
}
export function searchGoods(params){
    return instance({
        url:'/goods/list',
        method:'get',
        params:params,
    })
}

//详情页
export function getDetail(params) {
    return instance({
        url: '/goods/detail',
        method: 'get',
        params: params,

    })
}

// 加入购物车
export function addCarData(params) {
    return instance({
        url: '/cart/add',
        method: 'post',
        data: params,
        headers: { 'content-type': 'application/json' }
    })
}

// 获取购物车商品的总数量
export function getGoodsCount(params) {
    return instance({
        url: '/cart/goodscount',
        method: 'get',
        params: params,
    })
}



//专题
export function getTopicData(params){
    return instance({
        url:'/topic/list',
        method:'get',
        params:params,
    })
}



//分类
export function getCategoryData(params){
    return instance({
        url:'/catalog/index',
        method:'get',
        params:params,
    })
}


//分类 当前页
export function getCurrentData(params){
    return instance({
        url:'/catalog/current',
        method:'get',
        params:params,
    })
}



//购物车
export function GetCarData(params) {
    return instance({
        url: '/cart/index',
        method: 'get',
        params
    })
}


//购物车删除
export function DelCarData(params) {
    return instance({
        url: '/cart/delete',
        method: 'post',
        data: params

    })
}



//我的
export function LoginFn(params) {
    return instance({
        url: '/auth/loginByWeb',
        method: 'post',
        data: params

    })
}